import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import IconsResolver from "unplugin-icons/resolver";

export default function createComponents() {
    return Components({
        resolvers: [
            ElementPlusResolver(),
            // 自动导入图标组件
            IconsResolver({
              // @iconify-json/ep 是 Element Plus 的图标库
              enabledCollections: ["ep"],
            }),
        ],
        // 指定自定义组件位置(默认:src/components)
        dirs: ["src/components"],
        // 配置文件位置(false:关闭自动生成)
        // dts: false,
        dts: "src/types/components.d.ts",
    })
    /* const resolvers = []
    resolvers.push(ElementPlusResolver())
    return Components({
        resolvers,
        dirs: ['src/components'],
        include: [/\.vue$/, /\.vue\?vue/, /\.jsx$/],
        dts: false
    }) */
}
